package gui.panels.statistics;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import common.types.Pair;

public class GameHistoryTableModel extends AbstractTableModel {

    private static final long serialVersionUID = 1L;
    private static final String[] columnNames = { "You thought of", "I guessed" };
    private List<Pair<String,String>> pairs;
    
    public GameHistoryTableModel(List<Pair<String,String>> pairs) {
        this.pairs = pairs;
    }
    
    public int getRowCount() {
        return pairs.size();
    }

    public int getColumnCount() {
        return columnNames.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Pair<String, String> pair = pairs.get(rowIndex);
        return columnIndex == 0 ? pair.getLeft() : pair.getRight();
    }
    
    public String getColumnName(int col) {
        return columnNames[col];
    }
    
    public Class<?> getColumnClass(int c) {
        return getValueAt(0, c).getClass();
      }
}
